/*
 * @Author: sjr
 * @Date: 2021-01-27 22:23:14
 * @LastEditTime: 2021-01-27 22:31:36
 * @LastEditors: sjr
 * @Description: 描述
 * @FilePath: \leetcode\35.搜索插入位置.js
 */
/*
 * @lc app=leetcode.cn id=35 lang=javascript
 *
 * [35] 搜索插入位置
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number}
 */
var searchInsert = function(nums, target) {
  let searchIndex = nums.findIndex(item => item >= target)
  if(searchIndex === -1) {
    return nums.length
  }
  return searchIndex
};

// @lc code=end

